﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;

namespace DynaSpace
{
	internal partial class FormChoosePlugins : Form
	{
		private List<String> selectedFiles = new List<string>();
		private string[] files;

		internal FormChoosePlugins(string[] files)
		{
			InitializeComponent();

			this.files = files;

			foreach (string fileName in this.files)
			{
				var node = new TreeNode();
				node.Text = Path.GetFileNameWithoutExtension(fileName);
				node.Tag = fileName;
						
				treeComponents.Nodes.Add(node);
			}
		}

		private void FormChoosePlugins_Load(object sender, EventArgs e)
		{
			lblVersion.Text = Assembly.GetEntryAssembly().GetName().Version.ToString();
		}

		/// <summary>
		/// Vybrané soubory pluginů
		/// </summary>
		/// <returns></returns>
		public string[] GetSelectedFiles()
		{
			return treeComponents.Nodes
				.OfType<TreeNode>()
				.Where(tn => tn.Checked)
				.Select(tn => tn.Tag.ToString())
				.ToArray();
		}

		/// <summary>
		/// Hodnota volby FullScreen
		/// </summary>
		public bool Fullscreen
		{
			get
			{
				return cbxFullScreen.Checked;
			}
		}

		private void btnOk_Click(object sender, EventArgs e)
		{
			DialogResult = DialogResult.OK;
		}
	}
}
